chore(components): remove useToast / useConfirmationModal hooks, only provide global functions as interface #6823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were debugging an issue with @paula-stacho caused by useConfirmationModal hook behaving unexpectedly in the place where we had to use it inside an ag-grid table and while there was a legit reason why this didn't work correctly, it's not really obvious at a glance and it was mostly affecting usage when methods were accessed through the hooks (or rather using hooks required to instantiate another Area provider component outside of the main React rendering tree causing issues).
As both global methods and hooks are identical in behavior, while global being more versatile (can be used from non-UI code like actions if needed, which is the main purpose for this interface being added more or less), I'm dropping the hooks interface completely to avoid any confusion between which ones to use and reduce the api surface that we need to maintain.
As a drive-by I also changed the use-confirmation implementation to match the use-toast one better, both are valid, but use-toast one is more straightforward (the bug we were debugging was caused by more complicated wiring in the current use-confirmation implementation) and there's no point in having two patterns for virtually the same functionality